package com.zmx.b2c.order.messaging.listener;

import com.zmx.common.common.contents.MqQueueContents;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

/**
 * @Description: 监听消费 删除订单缓存
 * @ClassName: DeleteOrderCacheListener
 * @Author zhaomxr
 * @Date 2021-10-25 17:07
 */
@Slf4j
@Component
@RabbitListener(queues = MqQueueContents.DELETE_ORDERCACHE_QUEUE)
public class DeleteOrderCacheListener extends DeleteOrderCacheParent {

    @RabbitHandler
    @Override
    public void onMessage(@Payload String orderCode) {
        deleteKey(orderCode);
        log.info("补偿->删除订单缓存 完成，订单编号：{}", orderCode);
    }
}
